import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"

@Entity("user", { schema: "pums" })
export class User {
  @PrimaryGeneratedColumn({ type: "int", name: "user_id", comment: "用户ID" })
  userId: number;

  @Column("varchar", {
    name: "user_name",
    nullable: true,
    comment: "用户名",
    length: 100,
  })
  userName: string | null;

  @Column("varchar", {
    name: "user_pwd",
    nullable: true,
    comment: "用户密码",
    length: 100,
  })
  userPwd: string | null;

  @Column("blob", { name: "user_iv", comment: "用户密码加密IV" })
  userIv: Buffer;

  @Column("varchar", {
    name: "user_nickname",
    nullable: true,
    comment: "用户昵称",
    length: 100,
  })
  userNickname: string | null;

  @Column("varchar", {
    name: "user_avatar",
    nullable: true,
    comment: "用户头像地址",
    length: 100,
  })
  userAvatar: string | null;

  @Column("int", {
    name: "user_state",
    nullable: true,
    comment: "用户状态: 1可用 0不可用",
  })
  userState: number | null;

  @Column("datetime", {
    name: "last_login_time",
    nullable: true,
    comment: "最后登录时间",
  })
  lastLoginTime: Date | null | string;

  @Column("varchar", {
    name: "last_login_ip",
    nullable: true,
    comment: "最后登录IP地址",
    length: 100,
  })
  lastLoginIp: string | null;
}
